﻿using RpcSync.Model.DB;

namespace RpcSync.DAL.Repository
{
    internal class IdgeneratorDAL : IIdgeneratorDAL
    {
        private IRpcExtendResource<IdgeneratorModel> _BasicDAL;
        public IdgeneratorDAL(IRpcExtendResource<IdgeneratorModel> dal)
        {
            _BasicDAL = dal;
        }

        public int GetMaxWorkId(long sysTypeId)
        {
            return this._BasicDAL.Max(c => c.SystemTypeId == sysTypeId, c => c.WorkId);
        }
        public int GetWorkId(long serverId)
        {
            return this._BasicDAL.Get(c => c.ServerId == serverId, c => c.WorkId);
        }
        public void Add(IdgeneratorModel add)
        {
            this._BasicDAL.Insert(add);
        }
    }
}
